home *** CD-ROM | disk | FTP | other *** search
- Messages
- --------
-
- Messages is a unit which allows programs to display pop up error
- messages with a minimum of formatting. It uses Turbo
- Professional 5.0 for windowing and screen display. The central
- routine (Message) takes only 1 parameter which is a string. The
- string may contain imbedded commands which handle many aspects of
- how the windows and messages are to display.
-
- Constants
-
- CmdPre = #0
-
- This is the character that identifies message string commands.
- When encountered in a string, the Message routine will expect a
- command to follow.
-
- NewLnCmd = #0#1
-
- When included in a message string, this command will force the
- beginning of a new line. This must be used in messages that are
- longer than the width of the screen.
-
- TitleCmd #0#6
-
- This constant is used to block out the portion of the string that
- contains the window header and message window descriptors. This
- should appear once at the beginning and at the end of the header
- portion of the string.
-
- DelayCmd = #0#12
-
- This is the beginning of a three character command and should be
- directly followed by a 'parameter byte' which will be interpreted
- by the message parser. When this character sequence is
- encountered, the pop up window will remain on screen
- approximately n seconds, where n is specified by the parameter
- passed with this command (the byte directly following the
- command) OR until a key is pressed.
-
- The following command sequences are only valid when passed as
- part of the header portion of the string (between TitleCmd's):
-
- BeepCmd = #0#7
-
- Causes the bell to sound when the window is displayed.
-
- RowCmd = #0#8
-
- This is a three byte command it tells the message routine to
- position the top of the message window at the row specified by
- the parameter byte of this command. If the row specified is too
- low, the window will be moved up to the lowest row possible.
-
- ColCmd = #0#9
-
- This is a three byte command it tells the message routine to
- position the left side of the message window at the column specified by
- the parameter byte of this command. If the column specified is too
- high to fit the entire window, the window will be moved as far as
- possible to the left of the screen.
-
- PauseCmd = #0#10
-
- This command causes the window to remain on the screen until a
- key is pressed.
-
- LeaveCmd = #0#11
-
- Causes the message window to remain on screen until a call to the
- RemoveMsg procedure.
-
- LeftCmd = #0#3
-
- Causes each line of the message string to be left justified
- within the message window.
-
- RightCmd = #0#4
-
- Causes each line of the message string to be right justified
- within the message window.
-
- CenterCmd = #0#5
-
- Causes each line of the message string to be centered within the
- message window.
-
- Types
-
- MsgStr = String
-
- JustifyType = (Left, Right, Cntr)
-
- ReadKeyFunc = Function : Word
-
- LoopProc = Procedure
-
- Variables
-
- MsgWinTopRow,
- MsgWinFirstCol : Byte
-
- These variables provide the defaults for the positioning of the
- message window. They default to 0 for windows that are centered
- on the screen.
-
- MsgWinColor: FlexAttrs
-
- The default attributes of the message windows. Message strings
- are written using the FlexWriteWindow routine from TPCRT. The
- window color is set to MsgWinColor[0]
-
- MsgFrameColor,
- MsgTitleColor : byte
-
- These are the default colors for the window frames and headers.
-
- MsgWinDefLen : byte
-
- This is the default length of the message window. When set to 0,
- windows will be sized automatically. If set to a non-zero
- number, the window will be sized to this value OR the length it
- will need to fit the longest line of the message string,
- whichever is greater.
-
- MsgJust : JustifyType
-
- This is the default justification for messages, it is initially
- set to Cntr.
-
- MsgDisposeCh : boolean
-
- When set to true, message windows that wait for keypresses will
- "eat" the key and return to the calling routine. It this is set
- to false, the key will remain in the keyboard buffer.
-
- MsgReadKeyWord : ReadKeyFunc
-
- This is the default function used to read key input. It defaults
- to ReadKeyWord.
-
- MsgLoopProc : LoopProc
-
- This is a procedure that takes no parameters and is repeatedly
- executed while the message window is waiting for keyboard input.
- It defaults to a procedure that does nothing. Note that tis will
- not be executed in messages that contain the LeaveCmd, as these
- types of message windows do not wait for any keyboard input.
-
- Message Routines
-
- procedure SetMsgDefaults( WindowColor: FlexAttrs; FrameColor, TitleColor,
- TopRow, TopCol: byte; Just: JustifyType )
-
- This routine can be used to set some of the message unti defaults
- without accessing the individual variables directly.
-
- type CStr = String[3]
-
- function CmdStr( Cmd: CStr; P:byte ): CStr
-
- This function returns a string containing the parameter Cmd
- concatenated with char( P ). It provides a quick way to specify
- commands that take a parameter byte. Example:
-
- RowCmd + Char(5) is the same as
- CmdStr( RowCmd, 5)
-
- Note: It is often easier to simply use RowCmd+#5, however using
- the CmdStr function (in my opinion) just seems a bit more
- intuitive.
-
- procedure Message( S : MsgStr )
-
- This is the main routine which displays the message window and
- the associated string(s).
-
- procedure RemoveMsg
-
- Erases the last message window left on the screen using the
- LeaveCmd.
-
-